import React from 'react';
import { connect } from 'dva';
import PropTypes from 'prop-types';
import {Button,Row,Col,Layout,Icon,Form,Input,message,} from 'antd';
// import reqwest from 'reqwest';
import {Link} from 'dva/router';
import {reqwest_post} from '../../../utils/Reqwest.js'
// import style from '../../styles/ResetInput.less';
// import inStyle from '../../styles/Info.less'
import acct from '../Acct.less'
// import {numvail,selectvail} from '../../utils/Validator.js'
// import { Editor } from 'react-draft-wysiwyg'
// import {reqwest_get,reqwest_post} from '../../utils/Reqwest.js'
// import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
const FormItem = Form.Item;
class AcctList extends React.Component{
	constructor(props){
		super(props);
		console.log(this)
		this.state={
			list:props.list
		}
	}
	handlePay(e){
		console.log(1)
		let _this = this
		reqwest_post('/api/strategy_results/'+this.props.save.usr+'/pay',{
			access_token:window.localStorage['token'],
		},(data)=>{
			// console.log(2)
			// _this.context.router.goBack()
			if(data.status==='success'){
				message.success('支付成功');
				_this.context.router.push('/app/acctor?current='+this.props.current+'&typ=list')
				// _this.context.router.push('/app/acct_list?current='+_this.props.current+'&typ=list&usr='+_this.props.save.usr)
			}else{
				message.error(data.msg)
			}
		})
	}
	render(){

		const {list,order} =this.state;
    // const _remark = JSON.parse(list.remark)
    // console.log(this.props)
    	// this.props.save.typ='save'
		return(
			<div>
				<Row>
				<Col span={10}>
					<span>
						销售提成：
					</span>
					<span >
						{this.props.list.saler_rate_amount}
					</span>
				</Col>
				<Col span={10}>
					<span>
						销售主管提成提成：
					</span>
					<span>
						{this.props.list.saler_director_rate_amount}
					</span>
				</Col>
				<Col span={10}>
					<span>
						介绍人返利：
					</span>
					<span>
						{this.props.list.introducer_rebate_amount}
					</span>
				</Col>
				<Col span={10}>
					<span>
						运营提成：
					</span>
					<span>
							{this.props.list.operator_amount}
					</span>
				</Col>
				<Col span={10}>
					<span>
						售后提成：
					</span>
					<span>
							{this.props.list.cs_director_amount}
					</span>
				</Col>
				<Col span={10}>
					<span>
						企划提成：
					</span>
					<span>
						{this.props.list.planinger_director_amount}
					</span>
				</Col>

				</Row>
				<Row>
		 		<Col   >
		   		<div  style={{float:'left'}} >
		          <Button loading={this.props.loading} onClick={(e)=>this.handlePay(e)} size='large' type="primary"  >
		            支付
		          </Button>
		      </div>
		      <div  style={{float:'left',marginLeft:10}} >
		      	<Button size='large'  >
		          <Link to={{pathname:'/app/acct_list',query:{current:this.props.current,typ:'save',usr:this.props.save.usr}}}>修改</Link>
		        </Button>
		      </div>
		    </Col>
		  </Row>
		  </div>
		)
	}
}
export default AcctList
